<template>
	<uv-popup ref="popupRef" mode="center" round="28rpx">
		<view class="dia-pop">
			<view class="title">
				{{ title }}
			</view>
			<view class="content">
				{{ tip }}
			</view>
			<view class="btns">
				<button class="cu-btn" @click="handClose">取消</button>
				<button class="cu-btn" @click="handConfirm">{{ confirmText }}</button>
			</view>
		</view>
	</uv-popup>
</template>

<script setup>
	import {
		reactive,
		ref,
		defineProps,
		defineEmits
	} from 'vue'
	defineProps({
		title: {
			type: String,
			default: ''
		},
		tip: {
			type: String,
			default: ''
		},
		confirmText: {
			type: String,
			default: ''
		}
	})
	const emit = defineEmits(['confirm'])
	const handConfirm = () => {
		emit('confirm')
		handClose()
	}

	const popupRef = ref(null)
	const open = () => {
		popupRef.value.open()
	}
	const handClose = () => {
		popupRef.value.close()
	}
	defineExpose({
		open
	})
</script>

<style lang="scss" scoped>
	.dia-pop {
		width: 566rpx;
		background: linear-gradient(181deg, #FFF7E4 0%, #FFFFFF 100%);
		border-radius: 20rpx;
		padding: 40rpx 32rpx 48rpx 32rpx;

		.title {
			text-align: center;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.content {
			width: 380rpx;
			margin: 56rpx auto 0 auto;
			font-size: 30rpx;
			line-height: 45rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			text-align: center;
		}

		.btns {
			margin-top: 66rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			.cu-btn {
				width: 238rpx;
				height: 88rpx;
				background: #F5F5F5;
				border-radius: 16rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;

				&:last-child {
					margin-left: 26rpx;
					background: #FFC434;
				}
			}
		}
	}
</style>